#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/fcntl.h>
#include <string.h>

int main(void)
{
	int fd,
		ret = 0,
		i = 0;
	
	char wbuff[500]={0xaa}, rbuff[500]={0};
	memset(wbuff,0xaa,sizeof(wbuff));
	fd = open("/dev/mem_dev", O_RDWR);
	if (fd == -1)
	{
		printf("open devive failed\n");
	}
	if ((ret=write(fd, wbuff, sizeof(wbuff))) < 0)
	{
		printf("write devive failed:%d\n",ret);
	}
	if ((ret=read(fd, rbuff, sizeof(rbuff))) < 0)
	{
		printf("read devive failed:%d\n",ret);
	}
	else
	{
		for (i=0; i<16; i++)
			printf("%02x ", 0xff&rbuff[i]);	
		printf("\n");
	}
	
	close(fd);
	return 0;
}
